project(libapriltags)
set(PLUGIN_NAME "AprilTags")
message(STATUS "Plugin:${PLUGIN_NAME}")
file(GLOB APRILTAGS_CXX_SOURCES ${PROJECT_SOURCE_DIR}/src/*.cpp)
foreach (APRILTAGS_CXX_SOURCE ${APRILTAGS_CXX_SOURCES})
    message(STATUS "${PLUGIN_NAME}_CXX_SOURCE:${APRILTAGS_CXX_SOURCE}")
endforeach ()
file(GLOB APRILTAGS_C_SOURCES ${PROJECT_SOURCE_DIR}/src/*.c)
foreach (APRILTAGS_C_SOURCE ${APRILTAGS_C_SOURCES})
    message(STATUS "${PLUGIN_NAME}_C_SOURCE:${APRILTAGS_C_SOURCE}")
endforeach ()
file(GLOB APRILTAGS_HEADERS ${PROJECT_SOURCE_DIR}/include/libapriltags/*.h)
foreach (APRILTAGS_HEADER ${APRILTAGS_HEADERS})
    message(STATUS "${PLUGIN_NAME}_HEADER:${APRILTAGS_HEADER}")
endforeach ()
file(GLOB APRILTAGS_COMMON_HEADERS ${PROJECT_SOURCE_DIR}/include/common/*.h)
foreach (APRILTAGS_COMMON_HEADER ${APRILTAGS_COMMON_HEADERS})
    message(STATUS "${PLUGIN_NAME}_COMMON_HEADER:${APRILTAGS_COMMON_HEADER}")
endforeach ()

include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${PROJECT_SOURCE_DIR}/../../robot_client/include)
set(MRAA_INSTALL_DIR ${PROJECT_BINARY_DIR}/../../3rdparty/mraa/install/lib/pkgconfig)
find_package(PkgConfig REQUIRED)
set(ENV{PKG_CONFIG_PATH} ${MRAA_INSTALL_DIR}:ENV{PKG_CONFIG_PATH})

pkg_check_modules(MRAA REQUIRED mraa)
include_directories(${MRAA_INCLUDE_DIRS})
message(STATUS "MRAA_INCLUDE_DIRS:${MRAA_INCLUDE_DIRS}")
link_directories(${MRAA_LIBRARY_DIRS})
message(STATUS "MRAA_LIBRARY_DIRS:${MRAA_LIBRARY_DIRS}")
message(STATUS "MRAA_LIBRARIES:${MRAA_LIBRARIES}")
add_library(apriltags
        ${APRILTAGS_HEADERS}
        ${APRILTAGS_COMMON_HEADERS}
        ${APRILTAGS_CXX_SOURCES}
        ${APRILTAGS_C_SOURCES}
        )
target_link_libraries(apriltags rccore)